def generate_test_data():
    """生成测试数据"""
    test_cases = []
    
    # 基础测试用例
    test_cases.append(([3, 2, 4, 1], [4, 2, 4, 3]))
    test_cases.append(([1, 2, 3], []))
    test_cases.append(([2, 1], [2]))
    
    # 边界测试用例
    test_cases.append(([1], []))  # 单个元素
    test_cases.append(([2, 1], [2]))  # 两个元素
    test_cases.append(([3, 1, 2], [3, 2]))  # 三个元素
    
    return test_cases

def generate_edge_cases():
    """生成边界测试用例"""
    edge_cases = [
        ([1], []),           # 单个元素
        ([2, 1], [2]),       # 两个元素，需要翻转
        ([1, 2], []),        # 两个元素，已排序
        ([3, 2, 1], [3]),    # 三个元素，完全逆序
        ([1, 3, 2], [3, 2]), # 三个元素，部分逆序
        ([4, 3, 2, 1], [4, 2, 4, 3]),  # 四个元素，完全逆序
        ([2, 4, 1, 3], [4, 2, 4, 3]),  # 四个元素，乱序
    ]
    return edge_cases

def generate_large_test_cases():
    """生成大型测试用例"""
    large_cases = [
        ([5, 4, 3, 2, 1], [5, 2, 5, 3, 5, 4]),  # 五个元素，完全逆序
        ([1, 5, 2, 4, 3], [5, 2, 5, 4, 3, 5, 4]),  # 五个元素，乱序
        ([6, 5, 4, 3, 2, 1], [6, 2, 6, 3, 6, 4, 6, 5]),  # 六个元素，完全逆序
        ([2, 6, 1, 5, 3, 4], [6, 2, 6, 5, 3, 6, 4, 6, 5]),  # 六个元素，乱序
    ]
    return large_cases

if __name__ == "__main__":
    print("生成测试数据...")
    
    # 基础测试用例
    basic_cases = generate_test_data()
    print(f"基础测试用例数量: {len(basic_cases)}")
    
    # 边界测试用例
    edge_cases = generate_edge_cases()
    print(f"边界测试用例数量: {len(edge_cases)}")
    
    # 大型测试用例
    large_cases = generate_large_test_cases()
    print(f"大型测试用例数量: {len(large_cases)}")
    
    # 合并所有测试用例
    all_cases = basic_cases + edge_cases + large_cases
    print(f"总测试用例数量: {len(all_cases)}")
    
    # 保存到文件
    with open("test_data.txt", "w", encoding="utf-8") as f:
        f.write("测试数据\n")
        f.write("=" * 50 + "\n\n")
        
        for i, (arr, expected) in enumerate(all_cases):
            f.write(f"测试用例 {i+1}:\n")
            f.write(f"  输入: {arr}\n")
            f.write(f"  期望输出: {expected}\n")
            f.write("\n")
    
    print("测试数据已保存到 test_data.txt") 